///Project: Introducing GLP Paper Table 9 Imputeda Data
///Stata 13

*********************************TABLE 9**************************************
//1	None
//2	Trade union (national, supra-national)
//3	Employer’s organization (national, supra-national)
//4	Interest group (national, supra-national)
//5	NGO/Political movement/Governmental intl org
//6	Local gov/Municipal position
//7	Party org/admin/youth/ Political advisor
//8	Previous MP/Minister
clear all
use "GLP_mi_15 05 31.dta"
drop if missing(polexp)
count
tab polexp
save "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta",replace
count
count if power==1
count if power==3
count if office1==2
count if office1==7
count if office1==6
count if wealth==0
count if wealth==1
count if region==1
count if region==2
count if region==3
count if region==4
count if region==5
count if regime==0
count if regime==1

clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta", replace
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if wealth==0
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if wealth==1
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if regime==0
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if regime==1
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if region==1
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if region==2
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if region==3
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if region==4
duplicates drop country_nid, force
count
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if region==5
duplicates drop country_nid, force
count
**None**
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
gen temp=1
sort country_nid
by country_nid: egen none=total(temp) if polexp==1
by country_nid: egen allexp=total(temp)
gen percentage=none/allexp*100
keep if none<.
duplicates drop country_nid, force
merge m:1 country_nid using "Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*Apex* 
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
count
gen temp=1
sort country_nid
by country_nid: egen none=total(temp) if polexp==1
by country_nid: egen allexp=total(temp)
gen percentage=none/allexp*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage

*Top ten*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
count
gen temp=1
sort country_nid
by country_nid: egen none=total(temp) if polexp==1
by country_nid: egen allexp=total(temp)
gen percentage=none/allexp*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage

*Cabinet*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2 
count
gen temp=1
sort country_nid
by country_nid: egen none=total(temp) if polexp==1
by country_nid: egen allexp=total(temp)
gen percentage=none/allexp*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage

*Court*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7  
count
gen temp=1
sort country_nid
by country_nid: egen none=total(temp) if polexp==1
by country_nid: egen allexp=total(temp)
gen percentage=none/allexp*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage

*MPs*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6 
count
gen temp=1
sort country_nid
by country_nid: egen none=total(temp) if polexp==1
by country_nid: egen allexp=total(temp)
gen percentage=none/allexp*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage

/////////////////////////////////////////////////////
**Trade union**
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
drop if missing(polexp)
gen temp=1
sort country_nid
by country_nid: egen trade=total(temp) if polexp==2
by country_nid: egen allexp=total(temp)
gen percentage=trade/allexp*100
keep if trade<.
duplicates drop country_nid, force
merge m:1 country_nid using "Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list

sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*Apex* 
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
gen temp=1
sort country_nid
by country_nid: egen trade=total(temp) if polexp==2
by country_nid: egen allexp=total(temp)
gen percentage=trade/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Top ten*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
gen temp=1
sort country_nid
by country_nid: egen trade=total(temp) if polexp==2
by country_nid: egen allexp=total(temp)
gen percentage=trade/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Cabinet*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2 
gen temp=1
sort country_nid
by country_nid: egen trade=total(temp) if polexp==2
by country_nid: egen allexp=total(temp)
gen percentage=trade/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Court*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7  
gen temp=1
sort country_nid
by country_nid: egen trade=total(temp) if polexp==2
by country_nid: egen allexp=total(temp)
gen percentage=trade/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*MPs*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6 
gen temp=1
sort country_nid
by country_nid: egen trade=total(temp) if polexp==2
by country_nid: egen allexp=total(temp)
gen percentage=trade/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

//////////////////////////////
**Employer's association**
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
drop if missing(polexp)
gen temp=1
sort country_nid
by country_nid: egen employ=total(temp) if polexp==3
by country_nid: egen allexp=total(temp)
gen percentage=employ/allexp*100
keep if employ<.
duplicates drop country_nid, force
merge m:1 country_nid using "Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list

sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*Apex* 
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
gen temp=1
sort country_nid
by country_nid: egen employ=total(temp) if polexp==3
by country_nid: egen allexp=total(temp)
gen percentage=employ/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Top ten*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
gen temp=1
sort country_nid
by country_nid: egen employ=total(temp) if polexp==3
by country_nid: egen allexp=total(temp)
gen percentage=employ/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Cabinet*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2 
gen temp=1
sort country_nid
by country_nid: egen employ=total(temp) if polexp==3
by country_nid: egen allexp=total(temp)
gen percentage=employ/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Court*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7  
gen temp=1
sort country_nid
by country_nid: egen employ=total(temp) if polexp==3
by country_nid: egen allexp=total(temp)
gen percentage=employ/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*MPs*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6 
gen temp=1
sort country_nid
by country_nid: egen employ=total(temp) if polexp==3
by country_nid: egen allexp=total(temp)
gen percentage=employ/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

///////////////////////////////
**interest group**
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
drop if missing(polexp)
gen temp=1
sort country_nid
by country_nid: egen interest=total(temp) if polexp==4
by country_nid: egen allexp=total(temp)
gen percentage= interest/allexp*100
keep if interest<.
duplicates drop country_nid, force
merge m:1 country_nid using "Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list

sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*Apex* 
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
gen temp=1
sort country_nid
by country_nid: egen interest=total(temp) if polexp==4
by country_nid: egen allexp=total(temp)
gen percentage=interest/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Top ten*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
gen temp=1
sort country_nid
by country_nid: egen interest=total(temp) if polexp==4
by country_nid: egen allexp=total(temp)
gen percentage=interest/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Cabinet*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2 
gen temp=1
sort country_nid
by country_nid: egen interest=total(temp) if polexp==4
by country_nid: egen allexp=total(temp)
gen percentage=interest/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Court*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7  
gen temp=1
sort country_nid
by country_nid: egen interest=total(temp) if polexp==4
by country_nid: egen allexp=total(temp)
gen percentage=interest/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*MPs*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6 
gen temp=1
sort country_nid
by country_nid: egen interest=total(temp) if polexp==4
by country_nid: egen allexp=total(temp)
gen percentage=interest/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

///////////////////////////////
**NGO**
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
drop if missing(polexp)
gen temp=1
sort country_nid
by country_nid: egen ngo=total(temp) if polexp==5
by country_nid: egen allexp=total(temp)
gen percentage=ngo/allexp*100
keep if ngo<.
duplicates drop country_nid, force
merge m:1 country_nid using "Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/144
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*Apex* 
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
gen temp=1
sort country_nid
by country_nid: egen ngo=total(temp) if polexp==5
by country_nid: egen allexp=total(temp)
gen percentage=ngo/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Top ten*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
gen temp=1
sort country_nid
by country_nid: egen ngo=total(temp) if polexp==5
by country_nid: egen allexp=total(temp)
gen percentage=ngo/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Cabinet*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2 
gen temp=1
sort country_nid
by country_nid: egen ngo=total(temp) if polexp==5
by country_nid: egen allexp=total(temp)
gen percentage=ngo/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Court*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7  
gen temp=1
sort country_nid
by country_nid: egen ngo=total(temp) if polexp==5
by country_nid: egen allexp=total(temp)
gen percentage=ngo/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*MPs*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6 
gen temp=1
sort country_nid
by country_nid: egen ngo=total(temp) if polexp==5
by country_nid: egen allexp=total(temp)
gen percentage=ngo/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

///////////////////////////////////////////////////////////////
**local government**
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
drop if missing(polexp)
gen temp=1
sort country_nid
by country_nid: egen local=total(temp) if polexp==6
by country_nid: egen allexp=total(temp)
gen percentage=local/allexp*100
keep if local<.
duplicates drop country_nid, force
merge m:1 country_nid using "Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list

sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*Apex* 
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
gen temp=1
sort country_nid
by country_nid: egen local=total(temp) if polexp==6
by country_nid: egen allexp=total(temp)
gen percentage=local/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Top ten*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
gen temp=1
sort country_nid
by country_nid: egen local=total(temp) if polexp==6
by country_nid: egen allexp=total(temp)
gen percentage=local/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Cabinet*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2 
gen temp=1
sort country_nid
by country_nid: egen local=total(temp) if polexp==6
by country_nid: egen allexp=total(temp)
gen percentage=local/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Court*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7  
gen temp=1
sort country_nid
by country_nid: egen local=total(temp) if polexp==6
by country_nid: egen allexp=total(temp)
gen percentage=local/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*MPs*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6 
gen temp=1
sort country_nid
by country_nid: egen local=total(temp) if polexp==6
by country_nid: egen allexp=total(temp)
gen percentage=local/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

/////////////////////////////////////////////////////////////////
**MP/Minister**
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
drop if missing(polexp)
gen temp=1
sort country_nid
by country_nid: egen mpmin=total(temp) if polexp==7
by country_nid: egen allexp=total(temp)
gen percentage=mpmin/allexp*100
keep if mpmin<.
duplicates drop country_nid, force
merge m:1 country_nid using "Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list

sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*Apex* 
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
gen temp=1
sort country_nid
by country_nid: egen mpmin=total(temp) if polexp==7
by country_nid: egen allexp=total(temp)
gen percentage=mpmin/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Top ten*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
gen temp=1
sort country_nid
by country_nid: egen mpmin=total(temp) if polexp==7
by country_nid: egen allexp=total(temp)
gen percentage=mpmin/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Cabinet*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2 
gen temp=1
sort country_nid
by country_nid: egen mpmin=total(temp) if polexp==7
by country_nid: egen allexp=total(temp)
gen percentage=mpmin/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Court*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7  
gen temp=1
sort country_nid
by country_nid: egen mpmin=total(temp) if polexp==7
by country_nid: egen allexp=total(temp)
gen percentage=mpmin/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*MPs*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6 
gen temp=1
sort country_nid
by country_nid: egen mpmin=total(temp) if polexp==7
by country_nid: egen allexp=total(temp)
gen percentage=mpmin/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

/////////////////////////////////////////////////////////////
//Partisan
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
drop if missing(polexp)
gen temp=1
sort country_nid
by country_nid: egen partisan=total(temp) if polexp==8
by country_nid: egen allexp=total(temp)
gen percentage=partisan/allexp*100
keep if partisan<.
duplicates drop country_nid, force
merge m:1 country_nid using "Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*Apex* 
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==1
gen temp=1
sort country_nid
by country_nid: egen partisan=total(temp) if polexp==8
by country_nid: egen allexp=total(temp)
gen percentage=partisan/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Top ten*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if power==3
gen temp=1
sort country_nid
by country_nid: egen partisan=total(temp) if polexp==8
by country_nid: egen allexp=total(temp)
gen percentage=partisan/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Cabinet*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==2 
gen temp=1
sort country_nid
by country_nid: egen partisan=total(temp) if polexp==8
by country_nid: egen allexp=total(temp)
gen percentage=partisan/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*Court*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==7  
gen temp=1
sort country_nid
by country_nid: egen partisan=total(temp) if polexp==8
by country_nid: egen allexp=total(temp)
gen percentage=partisan/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage

*MPs*
clear all
use "/Users/user/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/polexp_mi8.dta"
keep if office1==6 
gen temp=1
sort country_nid
by country_nid: egen partisan=total(temp) if polexp==8
by country_nid: egen allexp=total(temp)
gen percentage=partisan/allexp*100
replace percentage=0 if missing(percentage) 
collapse (max) percentage, by(country_nid)
sum percentage


